package com.smart.tools;

import java.io.IOException;
import java.security.NoSuchAlgorithmException;

import org.apache.log4j.Logger;

import com.submail.config.AppConfig;
import com.submail.lib.MessageSend;
import com.submail.utils.ConfigLoader;

/**
 * 
 * 版权所有：xxxxxxx
 * @Description: 发送短信
 * @Title: SendSMSMsg.java 
 * @ClassName: SendSMSMsg 
 * @author tangyan 
 * @date 2019年2月20日 上午9:45:52 
 * @version V1.0
 */
public class SendSMSMsg {

	public static	Logger logger = Logger.getLogger(SendSMSMsg.class);
	
	private static AppConfig config= null;

	private static  MessageSend messageSend =null;

	static {
		config = ConfigLoader.createConfig("32266","ee99fd3647302f581f477fa5267103ce","normal");
		messageSend = new MessageSend(config);
	}

	/**
	 * 签名
	 */
	public static final String SIGNATURE ="【XXXX】";

	/**
	 * 
	 * @Title: sendMsg 
	 * @Description: 发送消息
	 * @author tangyan 
	 * @param phone
	 * @param content
	 */
	public static void sendMsg(String phone, String content){
		try {
			messageSend.addTo(phone);
			messageSend.addContent(content);
			//发送短信
			String result =  messageSend.send();
			logger.info(result);
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}


}
